package com.wzz.shop.realtime.etl.`trait`

import com.wzz.shop.realtime.etl.utils.KafkaProps
import org.apache.flink.api.common.serialization.SimpleStringSchema
import org.apache.flink.streaming.api.scala.DataStream
import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer011
import org.apache.flink.streaming.connectors.kafka.internals.KeyedSerializationSchemaWrapper


/**
 *
 * @author ${wzz}
 * @date 2021-09-14 19:35
 *
 */
//kafka数据源公共
trait BaseETL[T] {
   def kafkaProducer(topic:String)={
     new FlinkKafkaProducer011[String](
       topic,
       new KeyedSerializationSchemaWrapper[String](new SimpleStringSchema()),
       KafkaProps.getKafkaProperties()
     )
   }
  /**
   * 从kafka中读取数据，传递返回的数据类型
   */
  def getKafkaDataStream(topic: String):DataStream[T];

  def process():Unit
}
